package com.njuse.jvmfinal.Instruction;

import java.nio.ByteBuffer;

import com.njuse.jvmfinal.runtimestructure.Jframe;

public class ASTORE_N extends Instruction {
	   private int number;
	   
	   public ASTORE_N(int n) {
		   this.number=n;
	   }
	   
		public  void readindex(ByteBuffer reader) {
			//no need to read
		}
		
		public  void execute(Jframe frame) {
			int top=frame.getStacktop();
			Object[] stack=frame.getManagestack();
			Object temp=stack[top-1];
			top--;
			frame.setStacktop(top);
			Object[] local=frame.getLocal();
			local[number]=temp;
			frame.setLocal(local);
		}
}
